﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace YJKArch.FormatPainter
{
	public class FilterByElementType : ISelectionFilter
	{
		public FilterByElementType(Type type, BuiltInCategory category)
		{
			this.m_Type = type;
			this.m_Category = category;
		}

		public bool AllowElement(Element elem)
		{
            return null == this.m_Type || (elem.GetType() == this.m_Type && (int)this.m_Category == elem.Category.Id.IntegerValue);
		}

		public bool AllowReference(Reference reference, XYZ pos)
		{
			return false;
		}

		private Type m_Type;

        private BuiltInCategory m_Category = BuiltInCategory.INVALID;
	}
}
